forbiddenspeech <- forbiddenspeech %>%
mutate(nature_severity = factor(
ifelse(is.na(split_treat_severity), "Control", split_treat_severity),
levels = c(1, 2, 3, 4, "Control"),
labels = c("Slur", "Stereotype", "Dehumanizing", "Denial", "Control")
))
table(forbiddenspeech$nature_severity)
#Encoding target
forbiddenspeech$nature_target <- factor(forbiddenspeech$split_treat_identity,
levels = c(1, 2, 3, 4,5,6,7, 99),
labels = c("Racial","Racial","Racial", "Religious", "Religious", "Gays", "Women","Control"))
table(forbiddenspeech$nature_target)
forbiddenspeech$nature_targetdetailed <- factor(forbiddenspeech$split_treat_identity,
levels = c(1, 2, 3, 4,5,6,7, 99),
labels = c("Blacks", "Hispanics", "Asian", "Jews", "Muslims", "Gays","Women","Control"))
#Encoding reponses
forbiddenspeech$response_simple <- factor(forbiddenspeech$split_treat_response,
levels = c(1, 2, 3, 4,5,6,7,8,9,10, 99),
labels = c("Apology","Apology","Apology", "Excuse", "Excuse", "Excuse", "Defense","Defense","Defense","Nocomment","Control"))
forbiddenspeech$response_detailed <- factor(forbiddenspeech$split_treat_response,
levels = c(1, 2, 3, 4,5,6,7,8,9,10, 99),
labels = c("remorseapology","wokeapology","sorryoffended", "pleadignorance", "misspokeexcuse", "outofcontext", "denywrongdoing","playthevictim","goonattack","nocomment","Control"))
##Encoding Insensitive quote or response quote
forbiddenspeech$insensitive_quote <- factor(forbiddenspeech$split_treat_quote,
levels = c(1, 2, 9),
labels = c("quote1","quote2","Control"))
##Encoding Time
forbiddenspeech$timecomments <- factor(forbiddenspeech$split_treat_time,
levels = c(1, 2,9),
labels = c("yesterday","fiveyearsago","Control"))
##Encoding Planned
forbiddenspeech$planned <- factor(forbiddenspeech$split_treat_planned,
levels = c(1, 2,9),
labels = c("planned","unplanned","Control"))
##Encoding History
forbiddenspeech$history <- factor(forbiddenspeech$split_treat_history,
levels = c(1, 2,9),
labels = c("commentsbefore","nevercomments","Control"))
####Coding DVs
forbiddenspeech <-forbiddenspeech %>%
mutate(
wouldconsidernotvoting = case_when(
cand_consider==1  ~ 0,
cand_consider==2~ 1,
TRUE ~ NA
)
)
#Alternative DVs: thermometer, objectionable
forbiddenspeech$thermometer<-forbiddenspeech$FAVOR_therm
forbiddenspeech$objectionable<-forbiddenspeech$cand_draw
#Incongruence of different types, respondent-candidate
#Party
forbiddenspeech <- forbiddenspeech %>%
mutate(
incongparty_responscandidate = case_when(
pid3==2 & split_party==1  ~ 1, ##Candidate Democrat, resp republican
pid3==1  & split_party==2  ~ 1, ##Candidate Republican, resp democrat
pid3==1 & split_party==1  ~ 0, ##Candidate Democrat, resp republican
pid3==2  & split_party==2  ~ 0, ##Candidate Republican, resp democrat
TRUE ~ NA
)
)
#Race
forbiddenspeech <- forbiddenspeech %>%
mutate(
incongrace_responscandidate = case_when(
split_race==4 & race==1 ~ 0, ##Candidate white
split_race==2 & race==2 ~ 0, ##Candidate black
split_race==3 & race==3 ~ 0, ##Candidate hispanic
split_race==1 & race==4 ~ 0, ##Candidate asian
TRUE ~ 1
)
)
#Gender
forbiddenspeech <- forbiddenspeech %>%
mutate(
inconggender_responscandidate = case_when(
split_genderage==1 & gender==1  ~ 1, ##Male, female candidate
split_genderage==3 & gender==1  ~ 1, ##Male, female candidate
split_genderage==2 & gender==2 ~ 1, ##Female, male candidate
split_genderage==4 & gender==2  ~ 1, ##Female, male candidate
TRUE ~ 0
)
)
#Age
forbiddenspeech <- forbiddenspeech %>%
mutate(
incongage_responscandidate = case_when(
split_genderage==1 & age5>3  ~ 1, #young candidate, older respondent
split_genderage==2 & age5>3  ~ 1, #young candidate,older respondent
split_genderage==3 & age5<3~ 1, ##old candidate, younger respondent
split_genderage==4 & age5<3  ~ 1, ##old candidate, younger respondent
TRUE ~ 0
)
)
forbiddenspeech$incongparty_responscandidate <- factor(forbiddenspeech$incongparty_responscandidate, levels = c("1", "0"))
forbiddenspeech$incongrace_responscandidate <- factor(forbiddenspeech$incongrace_responscandidate, levels = c("1", "0"))
forbiddenspeech$inconggender_responscandidate <- factor(forbiddenspeech$inconggender_responscandidate, levels = c("1", "0"))
forbiddenspeech$incongage_responscandidate <- factor(forbiddenspeech$incongage_responscandidate, levels = c("1", "0"))
#Coding congruence response target
#Race
forbiddenspeech <- forbiddenspeech %>%
mutate(
congrace_respontarget = case_when(
#split_treat_identity==4 & race==1 ~ 1, ## white
split_treat_identity==1 & race==2 ~ 1, ## black
split_treat_identity==2 & race==3 ~ 1, ## hispanic
split_treat_identity==3 & race==4 ~ 1, ## asian
TRUE ~ 0 ) )
#Religion
forbiddenspeech <- forbiddenspeech %>%
mutate(
congreligion_respontarget = case_when(
split_treat_identity==4 & religpew==5 ~ 1, ## Jews
split_treat_identity==5 & religpew==6 ~ 1, ## Muslims
TRUE ~ 0
)
)
#Sexual orientation
forbiddenspeech <- forbiddenspeech %>%
mutate(
congsexorientation_respontarget = case_when(
split_treat_identity==6 & sexuality>1 & sexuality<6 ~ 1, ## Gays and other type of sexual orientation
TRUE ~ 0
)
)
#Gender
forbiddenspeech <- forbiddenspeech %>%
mutate(
conggender_responstarget = case_when(
split_treat_identity==7 & gender==2 ~ 1, ##Female and female target
TRUE ~ 0
)
)
###Recoding of treatment groups-respondent combinations
###Coding degree of congruence respondent-target
forbiddenspeech <- forbiddenspeech %>%
mutate(
cong_responstarget = case_when(
gender==2 & nature_target =="Women"  ~ 1,
race!=1 & nature_target =="Racial" ~ 1,
sexuality!=1 & nature_target =="Gays" ~ 1,
TRUE ~ 0
)
)
#coding number of mitigating circumstances
forbiddenspeech<-forbiddenspeech %>%
mutate(
fiveyears = case_when(
split_treat_time==1 ~ 0,
split_treat_time==2 ~ 1,
TRUE ~ NA
)
)
forbiddenspeech<-forbiddenspeech %>%
mutate(
frequent = case_when(
split_treat_history==1 ~ 1,
split_treat_history==2 ~ 0,
TRUE ~ NA
)
)
forbiddenspeech<-forbiddenspeech %>%
mutate(
facplanned = case_when(
planned=="planned" ~ 1,
planned=="unplanned" ~ 0,
TRUE ~ NA
)
)
####Counting mitigating circumstances
forbiddenspeech <- forbiddenspeech %>%
mutate( mitig_circum = fiveyears + 1-facplanned+ +1-frequent
)
forbiddenspeech <- forbiddenspeech %>%
mutate( agg_circum =  case_when(
mitig_circum==0  ~ 3,
mitig_circum==1  ~ 2,
mitig_circum==2  ~ 1,
mitig_circum==3  ~ 0 )
)
#### Congruence between respondent candidate
forbiddenspeech <- forbiddenspeech %>%
mutate(
cong_responscandidate = case_when(
split_genderage==2 & gender==1  ~ 1, ##Male
split_genderage==4 & gender==1  ~ 1, ##Male
split_genderage==1 & gender>1  ~ 1, ##Female
split_genderage==3 & gender>1  ~ 1, ##Female
split_race==4 & race==1 ~ 1, ##White
split_race<4 & race>1 ~ 1, ##Nonwhite
TRUE ~ 0
)
)
forbiddenspeech <- forbiddenspeech %>%
mutate(
white_pol = case_when(
split_race==4  ~ 1, ##White
split_race<4  ~ 0, ##Nonwhite
TRUE ~ 0
)
)
forbiddenspeech <- forbiddenspeech %>%
mutate(
man_pol = case_when(
split_genderage==2   ~ 1, ##Male
split_genderage==4   ~ 1, ##Male
split_genderage==1   ~ 0, ##FeMale
split_genderage==3  ~ 0, ##FeMale
TRUE ~ 0
)
)
forbiddenspeech <- forbiddenspeech %>%
mutate(
millennial_pol = case_when(
split_genderage==1   ~ 1,
split_genderage==2   ~ 1,
split_genderage==3   ~ 0,
split_genderage==4  ~ 0,
TRUE ~ 0
)
)
#Save cleaned data as CSV file
conjoint_theme<- theme(    text = element_text(size = 14),  # Increase font size
axis.text = element_text(size = 12),  # Increase axis text size
axis.title = element_text(size = 14),  # Increase axis title size
legend.text = element_text(size = 12),  # Increase legend text size
legend.title = element_text(size = 14),  # Increase legend title size
legend.position="none",
plot.title = element_text(size = 16),  # Increase plot title size
panel.border = element_rect(size = 1.5, color = "black"),  # Increase panel border size
axis.title.x = element_blank(),
plot.margin = margin(1, 1, 1, 1, unit = "cm")  # Adjust plot margins
)
plot_theme<- theme(    text = element_text(size = 14),  # Increase font size
axis.text = element_text(size = 12),  # Increase axis text size
axis.title = element_text(size = 14),  # Increase axis title size
legend.text = element_text(size = 12),  # Increase legend text size
legend.title = element_text(size = 14),  # Increase legend title size
legend.position="none",
plot.title = element_text(size = 16),  # Increase plot title size
panel.border = element_rect(size = 1.5, color = "black"),  # Increase panel border size
axis.title.x = element_blank(),
plot.margin = margin(1, 1, 1, 1, unit = "cm"),  # Adjust plot margins
panel.grid.major.x = element_blank(), # Remove major horizontal grid lines
panel.grid.minor.x = element_blank()
)
####Figure 2 ###
#######Figure 2A, Pred 0: Non-empty Content of remarks vs control
forbiddenspeech$anycontent2 <- factor(forbiddenspeech$anycontent, levels = c( "Anycontent","Control"))
table(forbiddenspeech$anycontent)
p0Anycontent <- plot( cregg::cj(forbiddenspeech,wouldconsidernotvoting~ anycontent2,
id = ~ answerid,
estimate = "mm",
))
p0Anycontentshow<-p0Anycontent +
conjoint_theme   +
geom_point(color = "red", size = 3) + # Change point color and thickness
scale_y_discrete(labels=c("Any treatment  \n (speech controversy)","Control \n (No speech controversy)","(Content)"))
p0Anycontentshow
ggsave(plot= p0Anycontentshow,"Figure2APredic0Anycontent.png",device=png)
#Fig 2B, Party
data_wouldb <- cregg::cj(subset(forbiddenspeech,pid7_with_leaners==1), wouldconsidernotvoting~ anycontent2, id = ~ respid, estimate = "mm")
data_woulda <- cregg::cj(subset(forbiddenspeech,pid7_with_leaners==3), wouldconsidernotvoting~ anycontent2, id = ~ respid, estimate = "mm")
####leaners
data_wouldb$group <- "Democrat"
data_woulda$group <- "Republican"
combined_data <- bind_rows(data_wouldb, data_woulda)
combined_plot <- ggplot(combined_data, aes(x = level, y = estimate, color = group)) +
geom_point(position = position_dodge(width = 0.5)) +
scale_x_discrete(labels=c("Any treatment  \n (speech controversy)","Control \n (No speech controversy)","(Content)"))+
theme_minimal() +  coord_flip()
combined_plotse<- combined_plot + geom_errorbar(aes(ymin = lower, ymax = upper), width = 0, position = position_dodge(width = 0.5))
pAnyContentParty<- combined_plotse   +
scale_y_continuous(limits = c(0, 1), expand = c(0, 0))+
plot_theme +
scale_color_manual(values = c("Democrat" = "blue", "Republican" = "red")) +
labs(title = " ", y = " ", x = " ", color = "Party")+
theme(legend.position="bottom",panel.border = element_rect(colour = "black", fill = NA, size = 1))+
guides(color = guide_legend(nrow = 2))
pAnyContentParty
ggsave(plot= pAnyContentParty,"Fig2BPred0AnyContentParty.png",device=png)
#Fig 2C, Ideology
data_wouldb <- cregg::cj(subset(forbiddenspeech,ideo3==1), wouldconsidernotvoting~ anycontent2, id = ~ respid, estimate = "mm")
data_woulda <- cregg::cj(subset(forbiddenspeech,ideo3==2), wouldconsidernotvoting~ anycontent2, id = ~ respid, estimate = "mm")
data_wouldd <- cregg::cj(subset(forbiddenspeech,ideo3==3), wouldconsidernotvoting~ anycontent2, id = ~ respid, estimate = "mm")
data_wouldb$group <- "Liberal"
data_woulda$group <- "Moderate"
data_wouldd$group <- "Conservative"
combined_data <- bind_rows(data_wouldb, data_woulda,data_wouldd)
combined_plot <- ggplot(combined_data, aes(x = level, y = estimate, color = group)) +
geom_point(position = position_dodge(width = 0.5)) +
scale_x_discrete(labels=c("Any treatment  \n (speech controversy)","Control \n (No speech controversy)","(Content)"))+
theme_minimal() +  coord_flip()
combined_plotse<- combined_plot + geom_errorbar(aes(ymin = lower, ymax = upper), width = 0, position = position_dodge(width = 0.5))
pAnyContentIdeo<- combined_plotse   +
scale_y_continuous(limits = c(0, 1), expand = c(0, 0))+
plot_theme +
labs(title = " ", y = " ", x = " ", color = "Ideology")+
theme(legend.position="bottom",panel.border = element_rect(colour = "black", fill = NA, size = 1))+
guides(color = guide_legend(nrow = 2))
pAnyContentIdeo
ggsave(plot= pAnyContentIdeo,"Fig2CPred0AnyContentIdeo.png",device=png)
###Figure 2D Race
data_wouldb <- cregg::cj(subset(forbiddenspeech,race==2), wouldconsidernotvoting~ anycontent2, id = ~ respid, estimate = "mm")
data_woulda <- cregg::cj(subset(forbiddenspeech,race==1), wouldconsidernotvoting~ anycontent2, id = ~ respid, estimate = "mm")
data_wouldc <- cregg::cj(subset(forbiddenspeech,race==4), wouldconsidernotvoting~ anycontent2, id = ~ respid, estimate = "mm")
data_wouldd <- cregg::cj(subset(forbiddenspeech,race==3), wouldconsidernotvoting~ anycontent2, id = ~ respid, estimate = "mm")
data_wouldb$group <- "Black"
data_woulda$group <- "White"
data_wouldc$group <- "Asian"
data_wouldd$group <- "Hispanic"
combined_data <- bind_rows(data_wouldb, data_woulda,data_wouldc,data_wouldd)
combined_plot <- ggplot(combined_data, aes(x = level, y = estimate, color = group)) +
geom_point(position = position_dodge(width = 0.5)) +
scale_x_discrete(labels=c("Any treatment  \n (speech controversy)","Control \n (No speech controversy)","(Content)"))+
theme_minimal() +  coord_flip()
combined_plotse<- combined_plot + geom_errorbar(aes(ymin = lower, ymax = upper), width = 0, position = position_dodge(width = 0.5))
pAnyContentRace<- combined_plotse   +
scale_y_continuous(limits = c(0, 1), expand = c(0, 0))+
plot_theme +
labs(title = " ", y = " ", x = " ", color = "Ethnicity")+
theme(legend.position="bottom",panel.border = element_rect(colour = "black", fill = NA, size = 1))+
guides(color = guide_legend(nrow = 2))
pAnyContentRace
ggsave(plot= pAnyContentRace,"Fig2DPred0AnyContentRace.png",device=png)
##Figure 2E, By Gender Pred.0
data_wouldb <- cregg::cj(subset(forbiddenspeech,gender==1), wouldconsidernotvoting~ anycontent2, id = ~ respid, estimate = "mm")
data_woulda <- cregg::cj(subset(forbiddenspeech,gender==2), wouldconsidernotvoting~ anycontent2, id = ~ respid, estimate = "mm")
data_wouldb$group <- "Male"
data_woulda$group <- "Female"
combined_data <- bind_rows(data_wouldb, data_woulda)
combined_plot <- ggplot(combined_data, aes(x = level, y = estimate, color = group)) +
geom_point(position = position_dodge(width = 0.5)) +
scale_x_discrete(labels=c("Any treatment  \n (speech controversy)","Control \n (No speech controversy)","(Content)"))+
theme_minimal() +  coord_flip()
combined_plotse<- combined_plot + geom_errorbar(aes(ymin = lower, ymax = upper), width = 0, position = position_dodge(width = 0.5))
pAnyContentGender<- combined_plotse   +
scale_y_continuous(limits = c(0, 1), expand = c(0, 0))+
plot_theme +
labs(title = " ", y = " ", x = " ", color = "Gender")+
theme(legend.position="bottom",panel.border = element_rect(colour = "black", fill = NA, size = 1))+
guides(color = guide_legend(nrow = 2))
pAnyContentGender
ggsave(plot= pAnyContentGender,"Fig2EPred0AnyContentGender.png",device=png)
#Fig 2F, Age, pred.0
data_wouldb <- cregg::cj(subset(forbiddenspeech,birthyr>1980), wouldconsidernotvoting~ anycontent2, id = ~ respid, estimate = "mm")
data_woulda <- cregg::cj(subset(forbiddenspeech,birthyr<1964), wouldconsidernotvoting~ anycontent2, id = ~ respid, estimate = "mm")
data_wouldb$group <- "Millennial or younger"
data_woulda$group <- "Older"
combined_data <- bind_rows(data_wouldb, data_woulda)
combined_plot <- ggplot(combined_data, aes(x = level, y = estimate, color = group)) +
geom_point(position = position_dodge(width = 0.5)) +
scale_x_discrete(labels=c("Any treatment  \n (speech controversy)","Control \n (No speech controversy)","(Content)"))+
theme_minimal() +  coord_flip()
combined_plotse<- combined_plot + geom_errorbar(aes(ymin = lower, ymax = upper), width = 0, position = position_dodge(width = 0.5))
pAnyContentAge<- combined_plotse   +
scale_y_continuous(limits = c(0, 1), expand = c(0, 0))+
plot_theme +
labs(title = " ", y = " ", x = " ", color = "Age")+
theme(legend.position="bottom",panel.border = element_rect(colour = "black", fill = NA, size = 1))+
guides(color = guide_legend(nrow = 2))
pAnyContentAge
ggsave(plot= pAnyContentAge,"Fig2FPred0AnyContentAge.png",device=png)
####################
####Figure 3##########
####################
####Figure 3A, Pred. 1a
forbiddenspeech$content <- factor(forbiddenspeech$nature_severity, levels = c("Slur",  "Dehumanizing", "Stereotype","Denial", "Control" ))
table(forbiddenspeech$content)
pContent <- plot( cregg::cj(forbiddenspeech,wouldconsidernotvoting~ content,
id = ~ answerid,
estimate = "mm",
))
##With boldness
pred1a <- pContent +
conjoint_theme +
geom_point(color = "red", size = 3) +  # Change point color and thickness
scale_y_discrete(labels = c(
expression(bold("Slur")),
expression(bold("Dehumanizing")),
expression(bold("Stereotype")),
expression(bold("Denial")),
"Control \n (No speech controversy)",
"(Content)"
)) +
theme(axis.text.y = element_text(face = "bold")) # Ensures y-axis labels are bold
pred1a
ggsave(plot= pred1a,"Fig3APred1aContent.png",device=png)
###Fig. 3B, Pred 1b: Congruence target and respondent
forbiddenspeech$faccong_responstarget <- factor(forbiddenspeech$cong_responstarget, levels = c("1", "0"))
table(forbiddenspeech$faccong_responstarget)
pCongruence <- plot( cregg::cj(forbiddenspeech,wouldconsidernotvoting~ faccong_responstarget,
id = ~ answerid,
estimate = "mm",
))
pred1b<-pCongruence +   conjoint_theme +
geom_point(color = "red", size = 3) +
scale_y_discrete(labels=c(expression(bold("Congruent")),"Incongruent","(Congruence \n target-respondent)"))
pred1b
ggsave(plot= pred1b,"Fig3BPred1Congtgt.png",device=png)
###Fig. 3C, Pred 2: Response: Excuses vs other
forbiddenspeech$facresponse <- factor(forbiddenspeech$response_simple, levels = c("Excuse","Defense","Apology","Nocomment",NA))
pDem_Response <- plot( cregg::cj(forbiddenspeech,wouldconsidernotvoting~ facresponse,
id = ~ answerid,
estimate = "mm",
),
)
pred2 <-pDem_Response + conjoint_theme+
geom_point(color = "red", size = 3) + # Change point color and thickness
scale_y_discrete(labels=c(expression(bold("Excuse")),"Defense",expression(bold("Apology")),"No comment","(Response)"))
pred2
ggsave(plot= pred2,"Fig3CPred2Excuses.png",device=png)
###Fig 3D, Pred 3: Aggravating circumstances
forbiddenspeech$agg_circum <- factor(forbiddenspeech$agg_circum, levels = c("3", "2","1","0"))
pDem_Circumstances <- plot( cregg::cj(forbiddenspeech,wouldconsidernotvoting~ agg_circum,
id = ~ answerid,
estimate = "mm",
),
)
pred3Main <-pDem_Circumstances + conjoint_theme +
geom_point(color = "red", size = 3)  +
scale_y_discrete(labels=c( expression(bold("Max aggravating \n circumst. (3)")),expression(bold("2")),"1","No aggravating \n circumst. (0)","(Aggravating \n circumstances)"))
pred3Main
ggsave(plot= pred3Main,"Fig3DPred3Main.png",device=png)
###Fig. 3E, Pred 4: Politician’s background traits (in- congruence with respondent)
forbiddenspeech$faccong_responscandidate <- factor(forbiddenspeech$cong_responscandidate, levels = c("0","1"))
pCongpoliticians <- plot( cregg::cj(forbiddenspeech,wouldconsidernotvoting~ faccong_responscandidate,
id = ~ answerid,
estimate = "mm",
),
)
pred4.2<-pCongpoliticians + conjoint_theme +
geom_point(color = "red", size = 3) +
scale_y_discrete(labels=c( "All incongruent \n factors","Some congruent \n factor","(Incongruence  \n candidate-respondent)"))
pred4.2
ggsave(plot= pred4.2,"Fig3EPred42Polincongruence.png",device=png)
####################
#####Figure A.2 AMCEs
####################
####Code different variables
forbiddenspeech<- forbiddenspeech %>%
mutate(women = case_when(
gender == 2~ 1,
TRUE~ 0),
nonwhite= case_when(
race == 1~ 0,
TRUE~ 1),
ageest=2024-birthyr,
collegegrad= case_when(
educ4>2 ~ 1,
TRUE~ 0),
demlean= case_when(
pid7<4 ~1,#democrat or leans democrat
TRUE ~0) )
######Plot of variously weighted effects AMCE
forbiddenspeech<- forbiddenspeech %>% mutate(incong_responscandidate= case_when(cong_responscandidate==0~ 1,
cong_responscandidate==1~ 0))
#Refactor to change Control to be the reference category
forbiddenspeech$nature_severity <- factor(forbiddenspeech$nature_severity,
levels = c("Control","Denial", "Stereotype", "Dehumanizing", "Slur"))
forbiddenspeech$nature_severity <- relevel(as.factor(forbiddenspeech$nature_severity), ref = "Control")
#aggcircm and response_simple2 that reduce the sample as they are undefined for the pure control group (they didn't receive that question)
#So we aggregate the missing and the control to No comment
forbiddenspeech<- forbiddenspeech %>% mutate(response_simple2= case_when(response_simple=="Control"~ "Nocomment",
is.na(response_simple)~ "Nocomment",
TRUE~ response_simple))
table(forbiddenspeech$response_simple2)
#Refactor to change Control to be the reference category, and shift order
forbiddenspeech$response_simple2 <- factor(forbiddenspeech$response_simple2,
levels = c("Defense", "Apology", "Excuse","Nocomment"))
forbiddenspeech$response_simple2 <- relevel(as.factor(forbiddenspeech$response_simple2), ref = "Nocomment")
forbiddenspeech <- forbiddenspeech %>%
mutate(agg_circum.num = as.numeric(as.character(agg_circum)),
agg_circum2 = case_when(is.na(agg_circum.num) ~ 0,
TRUE ~ agg_circum.num))
forbiddenspeech$agg_circum <- factor(forbiddenspeech$agg_circum, levels = c("3", "2","1","0"))
###Figure A2, Average marginal component effects (AMCEs) for each prediction
Maineffects<-lm(wouldconsidernotvoting ~ nature_severity+cong_responstarget+ response_simple2 +agg_circum2+incong_responscandidate,data=forbiddenspeech)
Maineffects.Covs<-lm(wouldconsidernotvoting ~ nature_severity+cong_responstarget+ response_simple2 +agg_circum2+incong_responscandidate +women+nonwhite+ageest+collegegrad+demlean+demlean+factor(res_region)+faminc_new,data=forbiddenspeech)
excluded_terms <- c("women", "nonwhite", "ageest", "collegegrad", "demlean",
"factor(res_region)2", "factor(res_region)3","factor(res_region)4", "faminc_new")
plotMainRaw<-coefplot::coefplot(Maineffects.Covs,xlim=c(-.1,.1),decreasing=TRUE,color="darkblue",intercept=FALSE,title="", outerCI=2.58, innerCI= 1.96,plot=TRUE,xlab="",ylab="")+theme_bw()+
theme(axis.text.y = element_text(size = 16)) +  # Increase coefficient label size
geom_hline(yintercept=c(1.5,2.5,5.5,6.5), linetype=6, color="grey")
plotMainRaw$data <- plotMainRaw$data %>% filter(!(Coefficient %in% excluded_terms))
plotMain<-plotMainRaw+
scale_y_discrete(labels=c( "Incongruence \n candidate-respondent","Aggravating \n circumstances", "Excuse","Apology",  "Defense", "Congruence \n target-respond.", "Slur","Dehumanizing","Stereotype","Denial"   ))
print(plotMain)
#Refactor to change Control to be the reference category
forbiddenspeech$nature_severity <- factor(forbiddenspeech$nature_severity,
levels = c("Control","Denial", "Stereotype", "Dehumanizing", "Slur"))
#Refactor to change Control to be the reference category, and shift order
forbiddenspeech$nature_severity <- relevel(as.factor(forbiddenspeech$nature_severity), ref = "Control")
forbiddenspeech$response_simple2 <- factor(forbiddenspeech$response_simple2,
levels = c("Defense", "Apology", "Excuse","Nocomment"))
forbiddenspeech$response_simple2 <- relevel(as.factor(forbiddenspeech$response_simple2), ref = "Nocomment")
forbiddenspeech <- forbiddenspeech %>%
mutate(agg_circum = as.numeric(as.character(agg_circum)),  # convert factor to numeric
agg_circum2 = case_when(is.na(agg_circum) ~ 0,
TRUE ~ agg_circum))
####AMCE plot these new variables. Note the need to use response_simple2
Main.thermometer.Covs<-lm(FAVOR_therm ~ nature_severity+cong_responstarget+ response_simple2 +agg_circum2+incong_responscandidate+collegegrad+demlean+factor(res_region)+faminc_new, data=forbiddenspeech)
Main.objectionable.Covs<-lm(cand_draw ~ nature_severity+cong_responstarget+ response_simple2 +agg_circum2+incong_responscandidate+women+nonwhite+ageest+collegegrad+demlean+factor(res_region)+faminc_new, data=forbiddenspeech)
excluded_terms <- c("women", "nonwhite", "ageest", "collegegrad", "demlean",
"factor(res_region)2", "factor(res_region)3","factor(res_region)4", "faminc_new")
plot.Main.thermometerRaw<-coefplot::coefplot(Main.thermometer.Covs,xlim=c(-.1,.1),decreasing=TRUE,color="red",intercept=FALSE,title="", outerCI=2.58, innerCI= 1.96,plot=TRUE,xlab="",ylab="")+theme_bw()+
geom_hline(yintercept=c(1.5,2.5,5.5,6.5), linetype=6, color="grey") +
theme(axis.text.y = element_text(size = 16))   # Increase coefficient label size
plot.Main.thermometerRaw$data <- plot.Main.thermometerRaw$data %>% filter(!(Coefficient %in% excluded_terms))
plot.Main.thermometerRawShow<- plot.Main.thermometerRaw+  scale_y_discrete(labels=c( "Incongruence \n candidate-respondent","Aggravating \n circumstances", "Excuse","Apology",  "Defense", "Congruence \n target-respond.",  "Slur", "Dehumanizing", "Stereotype","Denial"))
plot.Main.thermometerRawShow
